package com.gin.no_gay_alliance.adpter.user;

import android.content.Context;
import android.view.LayoutInflater;

import androidx.annotation.NonNull;

import com.gin.no_gay_alliance.adpter.base.BaseBindingRecyclerViewAdapter;
import com.gin.no_gay_alliance.databinding.ItemUserReputationBinding;
import com.gin.no_gay_alliance.viewmodel.ReputationModel;

import java.util.List;

/**
 * 用户中心 声望适配器
 *
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/9/7 11:10
 **/
public class UserReputationAdapter extends BaseBindingRecyclerViewAdapter<ItemUserReputationBinding, ReputationModel> {

    public UserReputationAdapter(Context context) {
        super(context);
    }

    public UserReputationAdapter(@NonNull Context context, @NonNull List<ReputationModel> data) {
        super(context, data);
    }

    /**
     * 绑定数据
     *
     * @param holder
     * @param b        绑定对象
     * @param position 位置
     * @param item
     */
    @Override
    protected void onBindViewHolder(ViewHolder<ItemUserReputationBinding> holder, @NonNull ItemUserReputationBinding b, int position, ReputationModel item) {
        b.tvLabel.setText(item.name);
        b.tvValue.setText(String.valueOf(item.value));
        b.tvRemark.setText(item.remark);
    }

    /**
     * 构造binding对象
     *
     * @param inflater
     * @return T
     */
    @NonNull
    @Override
    protected ItemUserReputationBinding buildBinding(LayoutInflater inflater) {
        return ItemUserReputationBinding.inflate(inflater);
    }

    /**
     * @return 是否应用斑马纹配色
     */
    @Override
    protected boolean useZebraStripe() {
        return false;
    }
}
